Previous Book Contents Book Index Next

Inside Macintosh: QuickTime /
Chapter 2 - Movie Toolbox / Movie Toolbox Reference
Functions for Getting and Playing Movies / Enhancing Movie Playback Performance


LoadMovieIntoRam

The LoadMovieIntoRam function loads a movie's data into memory. If the movie does not fit, the function returns an error.

pascal OSErr LoadMovieIntoRam (Movie theMovie, TimeValue time, 
                                 TimeValue duration,
                                 long flags);
theMovie
Specifies the movie for this operation. Your application obtains this movie identifier from such functions as NewMovie, NewMovieFromFile, and NewMovieFromHandle (described on page 2-80, page 2-76, and page 2-78, respectively).
time
Allows you to specify a portion of the movie to load. The time parameter contains the starting time of the movie segment to load. The duration parameter specifies the length of the segment to load.
duration
Allows you to specify a portion of the movie to load. The time parameter contains the starting time of the movie segment to load. The duration parameter specifies the length of the segment to load. You can use the GetMovieDuration function (described on page 2-170) to determine the length of the entire movie. Note that the Movie Toolbox may load more data than you specify due to the way the data is loaded.
flags
Gives you explicit control over what is loaded into memory and how long to keep it around. The following constants are provided. You can set these flags in any combination that makes sense for you.
keepInRam

Renders all data loaded with this flag set as nonpurgeable. Nonpurgeable data is not released from memory until you request it explicitly. This practice can fill up your heap very quickly. Exercise caution.
unkeepInRam

Renders all indicated data purgeable. The data is not necessarily released from memory immediately, however. Information about whether a chunk can be purged is maintained internally by a single bit. This means there is no counter. Therefore, if you care very much about the data, you have to work very hard and use the edit list meticulously.
flushFromRam

Purges all indicated data from memory, unless it is currently in use by a media handler (for example, if it is still drawing frames from the requested times). This flag makes the memory available for purging, and then performs the purge. You may want to use this option if you are particularly low on memory.
loadForwardTrackEdits
In some cases, an edited movie plays back much more smoothly if the data around edits is already in RAM. By setting either this flag or the lookBackwardTrackEdits flag, you can load only the data around edits. The Movie Toolbox walks through the edits and decides the right amount of data to load for you. If you are going to play the movie forward, set only the loadForwardTrackEdits flag. If you are going to play in both directions, or you don't know which direction, set both flags.
loadBackwardTrackEdits

In some cases, an edited movie plays back much more smoothly if the data around edits is already in RAM. By setting either this flag or lookForwardTrackEdits, you can load only the data around edits. The Movie Toolbox walks through the edits and decides the right amount of data to load for you. If you are going to play the movie only backward, set the loadBackwardTrackEdits flag. If you are going to play in both directions, or you don't know which direction, set both flags.
DESCRIPTION
If LoadMovieIntoRam fails because it was out of memory, no data is purged.

ERROR CODES
invalidMovie-2010This movie is corrupted or invalid
invalidDuration-2014This duration value is invalid
invalidTime-2015This time value is invalid
progressProcAborted-2019Your progress function returned an error
File Manager errors
Memory Manager errors


Previous Book Contents Book Index Next

© Apple Computer, Inc.
6 JUL 1996